package liwen.zhao;

import liwen.zhao.common.jd.vo.SysResult;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@MapperScan("liwen.zhao.mappers")
@EnableEurekaClient
public class ContentManagementStarter {
    public static void main(String[] args) {
        SpringApplication.run(ContentManagementStarter.class,args);
    }
    @Bean
    public SysResult initSysResult(){
        return SysResult.build(500, "服务器异常", null);
    }
    
    //以下是RabbitMQ相关初始化
    @Bean//声明一个队列
    public Queue queue01(){
        return new Queue("seckillQ",false,false,false,null);
    }
    @Bean//声明交换机
    public DirectExchange ex01(){
        return new DirectExchange("seckillEX");
    }
    @Bean//绑定关系
    public Binding bind01(){
        return BindingBuilder.bind(queue01()).to(ex01()).with("seckill");
    }
}
